home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu379.dms / pu379.adf / SuperRetLab / sretlab.c < prev    next >
C/C++ Source or Header  |  1990-07-02  |  15KB  |  670 lines

  1. /*
  2.  *  Super Return Label program
  3.  *    by Joel Swank 12-11-88
  4.  *
  5.  */
  6.  
  7. /********* INCLUDES ************************ */
  8.  
  9.  
  10. #include <exec/types.h>
  11. #include <exec/io.h>
  12. #include <exec/memory.h>
  13. #include <libraries/dos.h>
  14. #include <intuition/intuition.h>
  15. #include <stdio.h>
  16. #include <errno.h>
  17.  
  18. /* external Text in abouthelp.c  */
  19. extern struct IntuiText prerrtxt ;
  20. extern struct IntuiText prerrtxt2 ;
  21. extern struct IntuiText badcoptxt ;
  22. extern struct IntuiText oktxt ;
  23. extern struct IntuiText parfailtxt ;
  24. extern struct IntuiText prfailtxt ;
  25. extern struct IntuiText cantxt ;
  26. extern struct IntuiText retrytxt ;
  27.  
  28. /* Defines for setting/clearing GADGDISABLED flag */
  29. #define OffGad(gad) (gad).Flags = gad.Flags | GADGDISABLED;
  30. #define OnGad(gad) (gad).Flags = gad.Flags & ~(GADGDISABLED);
  31.  
  32.  
  33. struct IntuitionBase *IntuitionBase = NULL;
  34. struct GfxBase *GfxBase = NULL;
  35.  
  36. struct Window *wG = NULL;
  37. struct RastPort *rpG;
  38. struct IntuiMessage *message;    /* the message from the IDCMP */
  39.  
  40. struct Window *OpenWindow();
  41. struct IntuiMessage *GetMsg();
  42. struct MenuItem *ItemAddress();
  43. void *OpenLibrary();
  44. FILE *print;
  45.  
  46. /* get the PowerWindows 2.0 code */
  47. #include "srwindow.h"
  48.  
  49. /* internal modes */
  50. int lmode = 3 ;    /* number of lines - 3,4,5 */
  51. int cmode = 23 ;   /* number of characters per line - 19,23 */
  52.  
  53.  
  54. /* Amiga Printer escape sequences */
  55.  
  56. char eliteon[] = "\033[2w";
  57. char eliteoff[] = "\033[1w";
  58. char condensedon[] = "\033[4w";
  59. char condensedoff[] = "\033[3w";
  60. char lpi8on[] = "\033[0z";
  61. char lpi6on[] = "\033[1z";
  62. char boldon[] = "\033[1m";
  63. char boldoff[] = "\033[22m";
  64. char nlqon[] = "\033[2\"z";
  65. char nlqoff[] = "\033[1\"z";
  66. char doubon[] = "\033[6w";
  67. char douboff[] = "\033[5w";
  68. char italon[] = "\033[3m";
  69. char italoff[] = "\033[23m";
  70. char reset[] = "\033c";
  71.  
  72. /* Epson Printer escape sequences */
  73.  
  74. char Eeliteon[] = "\033M";
  75. char Eeliteoff[] = "\033P";
  76. char Econdensedon[] = "\033\017";
  77. char Econdensedoff[] = "\033\022";
  78. char Elpi8on[] = "\0330";
  79. char Elpi6on[] = "\0332";
  80. char Ereset[] = "\033@";
  81. char Esuperon[] = "\033S0";
  82. char Esuperoff[] = "\033T";
  83. char Six72nds[] = "\033A\06";
  84.  
  85. char blanks[] = "               "; /* blank stock for center() */
  86.  
  87. main()
  88. {
  89.     UWORD code;
  90.     ULONG class;
  91.     APTR object;
  92.  
  93.  
  94.     /* Open the libraries */
  95.  
  96.     IntuitionBase = (struct IntuitionBase *)
  97.         OpenLibrary("intuition.library", 0L);
  98.     if (IntuitionBase == NULL)
  99.         {
  100.         exit(99);
  101.         }
  102.     GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0L);
  103.     if (GfxBase == NULL)
  104.         {
  105.         done(98);
  106.         }
  107.  
  108.     /* Set up the Gadgets */
  109.     if (lmode == 3) OffGad(TextL4_Gad);
  110.     if (lmode == 3 || lmode == 4 ) OffGad(TextL5_Gad);
  111.     OffGad(Stop_Gad)
  112.     if (SubItem1.Flags & CHECKED) /* if Amiga */
  113.         {
  114.         OffGad(Line4_Gad)
  115.         OffGad(Line5_Gad)
  116.         }
  117.  
  118.  
  119.     wG = OpenWindow(&NewWindowStructure1);    /* open the window */
  120.     if ( wG == NULL )
  121.         {
  122.         done(2);
  123.         }
  124.  
  125.     rpG = wG->RPort;    /* get a rastport pointer for the window */
  126.  
  127.     SetMenuStrip(wG,&MenuList1);    /* attach my Menu */
  128.  
  129.     PrintIText(rpG,&IntuiTextList1,0L,0L);    /* Print the text */
  130.  
  131.  
  132.  
  133.     while(1)
  134.     {
  135.         WaitPort(wG->UserPort);
  136.             while( (message = (struct IntuiMessage *)
  137.                 GetMsg(wG->UserPort) ) != NULL)
  138.             {
  139.                 code = message->Code;  /* MENUNUM */
  140.                 object = message->IAddress;  /* Gadget */
  141.                 class = message->Class;
  142.                 ReplyMsg(message);
  143.                 switch (class)
  144.                     {
  145.                     case CLOSEWINDOW :
  146.                         done(0);
  147.                     case GADGETDOWN:
  148.                         if (object == (APTR) &Char23_Gad ||
  149.                             object == (APTR) &Char19_Gad)
  150.                             {
  151.                             do_chars(object);
  152.                             break;
  153.                             }
  154.                         /* only change lines if Epson selected */
  155.                         if (SubItem2.Flags & CHECKED)
  156.                         if (object == (APTR) &Line3_Gad ||
  157.                             object == (APTR) &Line4_Gad ||
  158.                             object == (APTR) &Line5_Gad)
  159.                             {
  160.                             do_lines(object);
  161.                             break;
  162.                             }
  163.                         break;
  164.                     case GADGETUP:
  165.                         if (object == (APTR) &Print_Gad)
  166.                             {
  167.                             do_print();
  168.                             break;
  169.                             }
  170.                         break;
  171.                     case MENUPICK:
  172.                         if (code != MENUNULL) do_pick((USHORT)code);
  173.                         break;
  174.                     }
  175.             }
  176.     } 
  177. }
  178.  
  179. /*
  180.  * Cleanup and exit
  181.  */
  182.  
  183. done(how)
  184. int how;
  185. {
  186.     if (wG) ClearMenuStrip(wG);
  187.     if (wG) CloseWindow(wG);
  188.     if (GfxBase != NULL) CloseLibrary(GfxBase);
  189.     if (IntuitionBase != NULL) CloseLibrary(IntuitionBase);
  190.     exit(how);
  191. }
  192.  
  193.  
  194. /*
  195.  * do_pick : handle chain of menu selections
  196.  */
  197.  
  198. do_pick(menunum)
  199. USHORT menunum;
  200. {
  201. struct MenuItem *item, *ItemAddress();
  202.     while (menunum != MENUNULL)
  203.         {
  204.         switch(MENUNUM(menunum))
  205.             {
  206.             case 0:     /* Project */
  207.             switch(ITEMNUM(menunum))
  208.                 {
  209.                 case 2: /* Quit */
  210.                     done(0);
  211.                 case 1: /* About */
  212.                     about();
  213.                     break;
  214.                 case 0: /* Help */
  215.                     help();
  216.                     break;
  217.                 }
  218.             break;
  219.             case 1:     /* Options */
  220.             switch(ITEMNUM(menunum))
  221.                 {
  222.                 case 1:     /* Printer */
  223.                 switch(SUBNUM(menunum))
  224.                     {
  225.                     case 0:   /* Amiga */
  226.                         /* remove all gadgets */
  227.                         RemoveGList(wG,&TextL1_Gad,-1L); 
  228.                         /* disable 4-line & 5-line */
  229.                         OffGad(Line4_Gad)
  230.                         OffGad(Line5_Gad)
  231.                         /* go to 3-line mode */
  232.                         go_3();
  233.                         /* add back gadgets and refresh screen */
  234.                         redraw_scr();
  235.                         break;
  236.                     case 1:   /* Epson */
  237.                         /* remove all gadgets */
  238.                         RemoveGList(wG,&TextL1_Gad,-1L); 
  239.                         /* enable 4-line & 5-line */
  240.                         OnGad(Line4_Gad)
  241.                         OnGad(Line5_Gad)
  242.                         /* add back gadgets and refresh screen */
  243.                         redraw_scr();
  244.                         break;
  245.                     }
  246.                 break;
  247.                 case 0:     /* Centering */
  248.                 switch(SUBNUM(menunum))
  249.                     {
  250.                     case 0:   /* On */
  251.                         center_on();
  252.                         break;
  253.                     case 1:   /* Off */
  254.                         center_off();
  255.                         break;
  256.                     }
  257.                 break;
  258.                 }
  259.             break;
  260.             default:    /* What's this garbage ? */
  261.                 menunum = MENUNULL;
  262.             }       /* end switch MENUNUM  */
  263.         item = ItemAddress(&MenuList1,(long) menunum);
  264.         menunum = item->NextSelect;
  265.         }
  266. }
  267.  
  268. /*
  269.  * turn off cenetring
  270.  */
  271.  
  272. center_off()
  273. {
  274.  
  275.     struct StringInfo *sptr;
  276.     /* remove all gadgets */
  277.     RemoveGList(wG,&TextL1_Gad,-1L); 
  278.     TextL1_Gad.Activation &= ~(STRINGCENTER); /* centering off */
  279.     TextL2_Gad.Activation &= ~(STRINGCENTER);
  280.     TextL3_Gad.Activation &= ~(STRINGCENTER);
  281.     TextL4_Gad.Activation &= ~(STRINGCENTER);
  282.     TextL5_Gad.Activation &= ~(STRINGCENTER);
  283.  
  284.     /* cleared because centered mode leaves them negative */
  285.     /*  which screws up display           */
  286.     sptr = (struct StringInfo *) TextL1_Gad.SpecialInfo;
  287.     sptr->DispPos = 0;   
  288.     sptr = (struct StringInfo *) TextL2_Gad.SpecialInfo;
  289.     sptr->DispPos = 0;   
  290.     sptr = (struct StringInfo *) TextL3_Gad.SpecialInfo;
  291.     sptr->DispPos = 0;
  292.     sptr = (struct StringInfo *) TextL4_Gad.SpecialInfo;
  293.     sptr->DispPos = 0;
  294.     sptr = (struct StringInfo *) TextL5_Gad.SpecialInfo;
  295.     sptr->DispPos = 0;
  296.     /* add back gadgets and refresh screen */
  297.     redraw_scr();
  298. }
  299.  
  300. /*
  301.  * turn on cenetring
  302.  */
  303.  
  304. center_on()
  305. {
  306.  
  307.     /* remove all gadgets */
  308.     RemoveGList(wG,&TextL1_Gad,-1L); 
  309.     TextL1_Gad.Activation |= STRINGCENTER;
  310.     TextL2_Gad.Activation |= STRINGCENTER;
  311.     TextL3_Gad.Activation |= STRINGCENTER;
  312.     TextL4_Gad.Activation |= STRINGCENTER;
  313.     TextL5_Gad.Activation |= STRINGCENTER;
  314.     /* add back gadgets and refresh screen */
  315.     redraw_scr();
  316. }
  317.  
  318. /*
  319.  *  do some printing
  320.  */
  321.  
  322. do_print()
  323. {
  324.     register long copies;
  325.     ULONG class;
  326.     char l1[25], l2[25], l3[25], l4[25], l5[25];
  327.     struct IntuiMessage *message;    /* the message from the IDCMP */
  328.     copies = atol(Copies_GadSIBuff);
  329.  
  330.     if (copies == 0) copies = 1;
  331.  
  332.     if (copies < 0)
  333.         {
  334.         AutoRequest(wG,&badcoptxt,0L,&oktxt,0L,0L,300L,75L);
  335.         return;
  336.         }
  337.  
  338.     /* Open the printer */
  339.     if (SubItem2.Flags & CHECKED) /* if Epson selected , par: */
  340.         {
  341.         while ((print = fopen("par:","w")) == NULL)
  342.             {
  343.             if (AutoRequest(wG,&parfailtxt,&retrytxt,&cantxt,
  344.                 0L,0L,300L,75L)) continue;
  345.             return;
  346.             }
  347.         }
  348.     else while ((print = fopen("prt:","w")) == NULL) /* Amiga, prt: */
  349.             {
  350.             if (AutoRequest(wG,&prfailtxt,&retrytxt,&cantxt,
  351.                 0L,0L,300L,75L)) continue;
  352.             return;
  353.             }
  354.  
  355.     off_gads();
  356.     pr_init();    /* init the printer */
  357.  
  358.     /* do cenetring if requested */
  359.     if (SubItem3.Flags & CHECKED) /* if ON selected , center em */
  360.         {
  361.         center(l1,TextL1_GadSIBuff);
  362.         center(l2,TextL2_GadSIBuff);
  363.         center(l3,TextL3_GadSIBuff);
  364.         center(l4,TextL4_GadSIBuff);
  365.         center(l5,TextL5_GadSIBuff);
  366.         }
  367.     else {      /* else just copy */
  368.         strcpy(l1,TextL1_GadSIBuff);
  369.         strcpy(l2,TextL2_GadSIBuff);
  370.         strcpy(l3,TextL3_GadSIBuff);
  371.         strcpy(l4,TextL4_GadSIBuff);
  372.         strcpy(l5,TextL5_GadSIBuff);
  373.         }
  374.  
  375.     while (copies > 0)
  376.         {
  377.         if (lmode == 4) /* do first 3 lines at 7/72 line spacing */
  378.             fprintf(print,"\033A\07");
  379.         fprintf(print,"%-*s%-*s%-*s\n",cmode,l1,cmode,l1,cmode,l1);
  380.         fprintf(print,"%-*s%-*s%-*s\n",cmode,l2,cmode,l2,cmode,l2);
  381.         fprintf(print,"%-*s%-*s%-*s\n",cmode,l3,cmode,l3,cmode,l3);
  382.             /* do last line at 15/72 line spacing */
  383.         if (lmode == 4)    fprintf(print,"\033A\017");
  384.         if (lmode == 4 || lmode == 5)
  385.             fprintf(print,"%-*s%-*s%-*s\n",cmode,l4,cmode,l4,cmode,l4);
  386.         if (lmode == 5)
  387.             fprintf(print,"%-*s%-*s%-*s\n",cmode,l5,cmode,l5,cmode,l5);
  388.         if (lmode != 4)    fputs("\n",print);
  389.  
  390.         if (ferror(print))   /* error on output file */
  391.             {
  392.             prerrtxt2.IText = (UBYTE *) sys_errlist[errno];
  393.             AutoRequest(wG,&prerrtxt,0L,&oktxt,0L,0L,300L,75L);
  394.             break;    /* early exit */
  395.             }
  396.  
  397.         copies--;
  398.         sprintf(Copies_GadSIBuff,"%ld",copies);
  399.         RefreshGList(&Copies_Gad,wG,NULL,1L);
  400.  
  401.  
  402.         Delay(20L);     /* keeps us down to printer speed */
  403.         if ( (message = (struct IntuiMessage *)
  404.           GetMsg(wG->UserPort) ) != NULL)
  405.             {
  406.             class = message->Class;
  407.             ReplyMsg(message);
  408.             if (class == CLOSEWINDOW) { pr_rest(); done(0); } /* exit */
  409.             if (class == MENUPICK) continue; /* ignore menus */
  410.             break;    /* else STOP */
  411.             }
  412.         }
  413.     pr_rest();
  414.     fclose(print);
  415.     on_gads();
  416. }
  417.  
  418. /*
  419.  * init the printer 
  420.  */
  421.  
  422. pr_init()
  423. {
  424.     if (SubItem2.Flags & CHECKED) /* if Epson selected */
  425.         {
  426.         if (lmode == 3) fputs(Elpi8on,print);
  427.         if (lmode == 5) fputs(Six72nds,print);
  428.         if (lmode == 5 || lmode == 4) fputs(Esuperon,print);
  429.         if (cmode == 23) fputs(Eeliteon,print);
  430.         fputs(Econdensedon,print);
  431.         }
  432.     else {      /* use amiga codes */
  433.         if (lmode == 3) fputs(lpi8on,print);
  434.         if (cmode == 23) fputs(eliteon,print);
  435.         fputs(condensedon,print);
  436.         }
  437. }
  438.  
  439. /*
  440.  * restore the printer 
  441.  */
  442.  
  443. pr_rest()
  444. {
  445.     if (SubItem2.Flags & CHECKED) /* if Epson selected */
  446.         {
  447.         fputs(Elpi6on,print);
  448.         if (cmode == 23) fputs(Eeliteoff,print);
  449.         fputs(Econdensedoff,print);
  450.         if (lmode == 5 || lmode == 4) fputs(Esuperoff,print);
  451.         }
  452.     else {      /* use amiga codes */
  453.         fputs(lpi6on,print);
  454.         if (cmode == 23) fputs(eliteoff,print);
  455.         fputs(condensedoff,print);
  456.         }
  457. }
  458.  
  459. /*
  460.  * center a line
  461.  */
  462.  
  463. center(line,buf)
  464. char *line, *buf;
  465. {
  466.     int l;
  467.     l = (cmode - strlen(buf))/2;
  468.     if (l > 0)  strncpy(line,blanks,l);
  469.     else l=0;
  470.     line[l] = '\0';
  471.     strcat(line,buf);
  472. }
  473.  
  474. /*
  475.  * turn back on gadgets after printing
  476.  */
  477.  
  478. on_gads()
  479. {
  480.     RemoveGList(wG,&TextL1_Gad,-1L); /* remove all gadgets */
  481.     OnGad(TextL1_Gad);    /* enable all */
  482.     OnGad(TextL2_Gad);
  483.     OnGad(TextL3_Gad);
  484.     if (lmode == 4 || lmode == 5) OnGad(TextL4_Gad);
  485.         if (lmode == 5) OnGad(TextL5_Gad);
  486.     OnGad(Char23_Gad);
  487.     OnGad(Char19_Gad);
  488.     OnGad(Line3_Gad);
  489.     if (SubItem2.Flags & CHECKED) /* if Epson selected */
  490.         {
  491.         OnGad(Line4_Gad);
  492.         OnGad(Line5_Gad);
  493.         }
  494.     OnGad(Print_Gad);
  495.     OffGad(Stop_Gad);   /* disable STOP */
  496.     redraw_scr();         /* add back gadgets and refresh screen */
  497.     SetMenuStrip(wG,&MenuList1);    /* attach my Menu */
  498. }
  499.  
  500. /*
  501.  * disable gadgets for printing
  502.  */
  503.  
  504. off_gads()
  505. {
  506.     ClearMenuStrip(wG);      /* disable menus */
  507.     RemoveGList(wG,&TextL1_Gad,-1L); /* remove all Gadgets */
  508.     OffGad(TextL1_Gad);    /* disable all but STOP and COPIES */
  509.     OffGad(TextL2_Gad);
  510.     OffGad(TextL3_Gad);
  511.     OffGad(TextL4_Gad);
  512.     OffGad(TextL5_Gad);
  513.     OffGad(Char23_Gad);
  514.     OffGad(Char19_Gad);
  515.     OffGad(Line3_Gad);
  516.     if (SubItem2.Flags & CHECKED) /* if Epson selected */
  517.         {
  518.         OffGad(Line4_Gad);
  519.         OffGad(Line5_Gad);
  520.         }
  521.     OffGad(Print_Gad);
  522.     OnGad(Stop_Gad);     /* enable STOP */
  523.     redraw_scr();         /* add back gadgets and refresh screen */
  524. }
  525.  
  526. /*
  527.  *  Handle line gadget change
  528.  */
  529.  
  530. do_lines(object)
  531. APTR object;
  532. {
  533.     struct Gadget *gad;
  534.     gad = (struct Gadget *) object;
  535.     RemoveGList(wG,&TextL1_Gad,-1L);
  536.     if (gad->Flags & SELECTED) /* it was on  */
  537.         {
  538.         if (object == (APTR) &Line3_Gad) go_4();
  539.         if (object == (APTR) &Line4_Gad) go_5();
  540.         if (object == (APTR) &Line5_Gad) go_3();
  541.         }
  542.     else {    /* it was off */
  543.         if (object == (APTR) &Line3_Gad) go_3();
  544.         if (object == (APTR) &Line4_Gad) go_4();
  545.         if (object == (APTR) &Line5_Gad) go_5();
  546.         }
  547.     redraw_scr();
  548.  
  549. }
  550.  
  551. /*
  552.  * To 3-line lmode
  553.  */
  554.  
  555. go_3()
  556. {
  557.     Line4_Gad.Flags = Line4_Gad.Flags  & ~(SELECTED);
  558.     Line5_Gad.Flags = Line5_Gad.Flags  & ~(SELECTED);
  559.     Line3_Gad.Flags = Line3_Gad.Flags  | SELECTED;
  560.     OffGad(TextL4_Gad);
  561.     OffGad(TextL5_Gad);
  562.     lmode = 3;
  563. }
  564.  
  565.  
  566. /*
  567.  * To 4-line lmode
  568.  */
  569.  
  570. go_4()
  571. {
  572.     Line5_Gad.Flags = Line5_Gad.Flags  & ~(SELECTED);
  573.     Line3_Gad.Flags = Line3_Gad.Flags  & ~(SELECTED);
  574.     Line4_Gad.Flags = Line4_Gad.Flags  | SELECTED;
  575.     OnGad(TextL4_Gad);
  576.     OffGad(TextL5_Gad);
  577.     lmode = 4;
  578. }
  579.  
  580.  
  581. /*
  582.  * To 5-line lmode
  583.  */
  584.  
  585. go_5()
  586. {
  587.     Line4_Gad.Flags = Line4_Gad.Flags  & ~(SELECTED);
  588.     Line3_Gad.Flags = Line3_Gad.Flags  & ~(SELECTED);
  589.     Line5_Gad.Flags = Line5_Gad.Flags  | SELECTED;
  590.     OnGad(TextL4_Gad);
  591.     OnGad(TextL5_Gad);
  592.     lmode = 5;
  593. }
  594.  
  595. /*
  596.  *  Handle char gadget change
  597.  */
  598.  
  599. do_chars(object)
  600. APTR object;
  601. {
  602.     struct Gadget *gad;
  603.     gad = (struct Gadget *) object;
  604.     RemoveGList(wG,&TextL1_Gad,-1L);
  605.     if (gad->Flags & SELECTED) /* it was on */
  606.         {                     /* . . so turn it off and other one on */
  607.         if (object == (APTR) &Char23_Gad) go_19();
  608.         if (object == (APTR) &Char19_Gad) go_23();
  609.         }
  610.     else {     /* it was off */
  611.         if (object == (APTR) &Char23_Gad) go_23();
  612.         if (object == (APTR) &Char19_Gad) go_19();
  613.         }
  614.  
  615.     TextL1_GadSInfo.MaxChars = (SHORT) cmode+1;
  616.     TextL2_GadSInfo.MaxChars = (SHORT) cmode+1;
  617.     TextL3_GadSInfo.MaxChars = (SHORT) cmode+1;
  618.     TextL4_GadSInfo.MaxChars = (SHORT) cmode+1;
  619.     TextL5_GadSInfo.MaxChars = (SHORT) cmode+1;
  620.     redraw_scr();
  621. }
  622.  
  623.  
  624. /*
  625.  * To 19-character lmode
  626.  */
  627.  
  628. go_19()
  629. {
  630.     cmode = 19;
  631.     Char19_Gad.Flags = Char19_Gad.Flags  | SELECTED;
  632.     Char23_Gad.Flags = Char23_Gad.Flags  & ~(SELECTED);
  633.     TextL1_GadSIBuff[19] = '\0';  /* truncate buffers */
  634.     TextL2_GadSIBuff[19] = '\0';
  635.     TextL3_GadSIBuff[19] = '\0';
  636.     TextL4_GadSIBuff[19] = '\0';
  637.     TextL5_GadSIBuff[19] = '\0';
  638. }
  639.  
  640.  
  641. /*
  642.  * To 23-character lmode
  643.  */
  644.  
  645. go_23()
  646. {                     /* . . so turn it on and other one off */
  647.     Char19_Gad.Flags = Char19_Gad.Flags  & ~(SELECTED);
  648.     Char23_Gad.Flags = Char23_Gad.Flags  | SELECTED;
  649.     cmode = 23;
  650. }
  651.  
  652. /*
  653.  * Redraw Window
  654.  *  Assumes Gadgets have been removed
  655.  */
  656.  
  657. redraw_scr()
  658. {
  659.     SetAPen(rpG,0L);
  660.     RectFill(rpG,2L,22L,(long)wG->Width-3,(long)wG->Height-2);
  661.     AddGList(wG,&TextL1_Gad,0L,-1L,NULL);
  662.     RefreshGList(&TextL1_Gad,wG,NULL,-1L);
  663.     PrintIText(rpG,&IntuiTextList1,0L,0L);    /* Print the text */
  664. }
  665. _abort()
  666. {
  667.  
  668.     done(6);
  669. }
  670.